import express from "express";
import { HOST, PORT } from "./env";
import devConfig from "./configs/webpack.dev";
import chalk from "chalk";
import { webpackMiddleware } from "./middlewares";
import webpack from "webpack";
function bootstrap() {
  let devServer = express();
  devServer.use(webpackMiddleware(webpack(devConfig)));
  devServer.listen(PORT, HOST, (err) => {
    if (err) {
      console.error(err);
      return;
    }
    console.log(
      `DevServer is running at ${chalk.magenta.underline(
        `http://${HOST}:${PORT}`
      )} `
    );
  });
}
if (require.main === module) {
  bootstrap();
}
